Don't allow -1 as minimum-key-length. (gtk_entry_completion_set_model):
authorMatthias Clasen <mclasen@redhat.com>
Wed, 26 Jan 2005 06:46:51 +0000 (06:46 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Wed, 26 Jan 2005 06:46:51 +0000 (06:46 +0000)
2005-01-26  Matthias Clasen  <mclasen@redhat.com>

* gtk/gtkentrycompletion.c (gtk_entry_completion_class_init):
Don't allow -1 as minimum-key-length.
(gtk_entry_completion_set_model): Add missing notification.
(gtk_entry_completion_set_minimum_key_length): Add missing
notification, allow setting minimum-key-length to 0.  (#165194,
Vincent Ladeuil)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtkentry.c
gtk/gtkentrycompletion.c

index 3e0771ce2dfa14abce0f4e36c2cec1b32f6270a1..68fd1133b37aa36c5b8ecde1880df55e244a1e45 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2005-01-26  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_class_init): 
+       Don't allow -1 as minimum-key-length.
+       (gtk_entry_completion_set_model): Add missing notification.
+       (gtk_entry_completion_set_minimum_key_length): Add missing
+       notification, allow setting minimum-key-length to 0.  (#165194,
+       Vincent Ladeuil)
+
 2005-01-26  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkaboutdialog.c (display_license_dialog): Make sure
index 3e0771ce2dfa14abce0f4e36c2cec1b32f6270a1..68fd1133b37aa36c5b8ecde1880df55e244a1e45 100644 (file)
@@ -1,3 +1,12 @@
+2005-01-26  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_class_init): 
+       Don't allow -1 as minimum-key-length.
+       (gtk_entry_completion_set_model): Add missing notification.
+       (gtk_entry_completion_set_minimum_key_length): Add missing
+       notification, allow setting minimum-key-length to 0.  (#165194,
+       Vincent Ladeuil)
+
 2005-01-26  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkaboutdialog.c (display_license_dialog): Make sure
index 3e0771ce2dfa14abce0f4e36c2cec1b32f6270a1..68fd1133b37aa36c5b8ecde1880df55e244a1e45 100644 (file)
@@ -1,3 +1,12 @@
+2005-01-26  Matthias Clasen  <mclasen@redhat.com>
+
+       * gtk/gtkentrycompletion.c (gtk_entry_completion_class_init): 
+       Don't allow -1 as minimum-key-length.
+       (gtk_entry_completion_set_model): Add missing notification.
+       (gtk_entry_completion_set_minimum_key_length): Add missing
+       notification, allow setting minimum-key-length to 0.  (#165194,
+       Vincent Ladeuil)
+
 2005-01-26  Matthias Clasen  <mclasen@redhat.com>
 
        * gtk/gtkaboutdialog.c (display_license_dialog): Make sure
index c5e0ee9548347bb86db77760bcfc138a205ffaf6..62544d83bc4cff61ae42ca563cf773f6e607eb65 100644 (file)
@@ -5178,7 +5178,8 @@ gtk_entry_completion_changed (GtkWidget *entry,
     return;
 
   /* no need to normalize for this test */
-  if (! strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry))))
+  if (completion->priv->minimum_key_length > 0 &&
+      strcmp ("", gtk_entry_get_text (GTK_ENTRY (entry))) == 0)
     {
       if (GTK_WIDGET_VISIBLE (completion->priv->popup_window))
         _gtk_entry_completion_popdown (completion);
index 5cae4ab142e6b65aee9155e792afc199cb333cb9..2c742054e91e6a885baae3b774283ca7576fb3a0 100644 (file)
@@ -278,7 +278,7 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
                                    g_param_spec_int ("minimum_key_length",
                                                      P_("Minimum Key Length"),
                                                      P_("Minimum length of the search key in order to look up matches"),
-                                                     -1,
+                                                     0,
                                                      G_MAXINT,
                                                      1,
                                                      G_PARAM_READWRITE));
@@ -942,6 +942,8 @@ gtk_entry_completion_set_model (GtkEntryCompletion *completion,
                            GTK_TREE_MODEL (completion->priv->filter_model));
   g_object_unref (completion->priv->filter_model);
 
+  g_object_notify (G_OBJECT (completion), "model");
+
   if (GTK_WIDGET_VISIBLE (completion->priv->popup_window))
     _gtk_entry_completion_resize_popup (completion);
 }
@@ -1014,9 +1016,14 @@ gtk_entry_completion_set_minimum_key_length (GtkEntryCompletion *completion,
                                              gint                length)
 {
   g_return_if_fail (GTK_IS_ENTRY_COMPLETION (completion));
-  g_return_if_fail (length >= 1);
+  g_return_if_fail (length >= 0);
 
-  completion->priv->minimum_key_length = length;
+  if (completion->priv->minimum_key_length != length)
+    {
+      completion->priv->minimum_key_length = length;
+     
+      g_object_notify (G_OBJECT (completion), "minimum_key_length");
+    }
 }
 
 /**